// UIImage+Resize.h
// Created by Trevor Harmon on 8/5/09.
// Free for personal or commercial use, with or without modification.
// No warranty is expressed or implied.

// Extends the UIImage class to support resizing/cropping
#import <UIKit/UIKit.h>

#define LENGTH_BASIC            (isPad?108.0f:54.0f)
#define MAX_BUBBLE_LENGTH       LENGTH_BASIC*6        //鱼信聊天气泡的最大高宽
#define MIN_BUBBLE_LENGTH       LENGTH_BASIC*3        //鱼信聊天气泡的最小高宽
#define SUPER_BUBBLE_LENGTH     LENGTH_BASIC*9        //超宽图的宽度

#define LENGTH_BASIC_Circle_Max            LENGTH_BASIC*2
#define LENGTH_BASIC_Circle_Min            71

#define MAX_BUBBLE_LENGTH_CIRCLE       LENGTH_BASIC_Circle_Max*5        //鱼信聊天气泡的最大高宽
#define MIN_BUBBLE_LENGTH_CIRCLE       LENGTH_BASIC_Circle_Min*5        //鱼信聊天气泡的最小高宽

@interface UIImage (Resize)
- (UIImage *)croppedImage:(CGRect)bounds;
- (UIImage *)thumbnailImage:(NSInteger)thumbnailSize
          transparentBorder:(NSUInteger)borderSize
               cornerRadius:(NSUInteger)cornerRadius
       interpolationQuality:(CGInterpolationQuality)quality;
- (UIImage *)resizedImage:(CGSize)newSize
     interpolationQuality:(CGInterpolationQuality)quality;
- (UIImage *)resizedImageWithContentMode:(UIViewContentMode)contentMode
                                  bounds:(CGSize)bounds
                    interpolationQuality:(CGInterpolationQuality)quality;

/**
 * 除了消息功能，其他功能界面图片展示缩略图获取方法，返回的是一个矩形缩略图，大小默认162*162
 */
-(UIImage*)getThumbImageForOther;

/**
 *  获取鱼信气泡缩略图，有处理超长和超宽图
 *
 *  @return 处理后的图片
 */
-(UIImage*)getThumbImageForMessage;


/**
 *  获取鱼榜缩略图，有处理超长和超宽图
 *
 *  @return 处理后的图片
 */
-(UIImage*)getThumbImageForCircle;


// 获得等比缩放的图片
-(UIImage*)getCenterImage:(CGSize)originSize thumbSize:(CGSize)thumbSize;
/**
 *  通过类型获取缩略图获取方法
 *
 *  @param size      需要的尺寸
 *  @param longImage 长图是否需要截取中间的部分
 *  @param length    最大的长度，单位是kb
 *
 *  @return 返回缩略图
 */
-(UIImage*)getThumbImageBySize:(CGSize)size isGetTopOrLeftForLongImage:(BOOL)longImage maxLength:(NSInteger)length;

//获取中图
-(UIImage*)getMediumImage;
/**
 *  缩放图片到Size大小
 *
 *  @param size 要缩放到的大小
 *
 *  @return 返回缩放后的图片
 */
-(UIImage*)scaleToSize:(CGSize)size;

/**
 *  获取中图数据
 *
 *  @return 中图data
 */
-(NSData*)getMediumImageData;

/**
 *  原图数据
 *
 *  @return 原图data
 */
-(NSData*)getRawImageData;

/**
 *  缩放图片到Size大小（适配2倍和3倍图）
 *
 *  @param size 要缩放到的大小
 *
 *  by Hanjun Hong 15.10.31
 *  @return 返回缩放后的图片
 */
- (UIImage *)adaptToSize:(CGSize)size;
@end
